const Axios = require('../utils/request');
const API = '/common';

// 获取省份信息
const getLocationInfo = params => {
  return Axios.http({url: API + '/getLocationInfo', data: params, method: 'GET'})
}
// 校验图形验证码
const checkCaptcha = params => {
  return Axios.http({url: API + '/captcha/checkCaptcha', data: params, method: 'POST'})
}
// 获取图形验证码
const getAppletCaptcha = params => {
  return Axios.http({url: API + '/captcha/getAppletCaptcha', data: params, method: 'GET'})
}
// 用户名密码登录
const passwordLogin = params => {
  return Axios.http({url: API + '/user/passwordLogin', data: params, method: 'POST'})
}
// 用户手机号登录
const phoneLogin = params => {
  return Axios.http({url: API + '/user/phoneLogin', data: params, method: 'POST'})
}
// 校验验证码
const checkSms = params => {
  return Axios.http({url: API + '/sms/checkSms', data: params, method: 'POST'})
}
// 发送忘记密码验证码
const sendForgotPasswordSms = params => {
  return Axios.http({url: API + '/sms/sendForgotPasswordSms', data: params, method: 'POST'})
}
// 发送修改号码验证码
const sendModifyPhoneNumberSms = params => {
  return Axios.http({url: API + '/sms/sendModifyPhoneNumberSms', data: params, method: 'POST'})
}
// 发送注册验证码
const sendRegisterSms = params => {
  return Axios.http({url: API + '/sms/sendRegisterSms', data: params, method: 'POST'})
}
// 发送小程序登录验证码
const sendXcxLoginSms = params => {
  return Axios.http({url: API + '/sms/sendXcxLoginSms', data: params, method: 'POST'})
}
// 用户接口：判断手机号是否注册，返回值true代表已注册
const getPhoneNumberRegistered = params => {
  return Axios.http({url: API + '/user/getPhoneNumberRegistered', data: params, method: 'GET'})
}
// 用户接口：手机号注册
const phoneRegister = params => {
  return Axios.http({url: API + '/user/phoneRegister', data: params, method: 'POST'})
}
// 用户绑定微信
const bindXcxWeiXin = params => {
  return Axios.http({url: API + '/user/bindXcxWeiXin', data: params, method: 'POST'})
}
// 用户解绑微信
const unbindWeiXin = params => {
  return Axios.http({url: API + '/user/unbindWeiXin', data: params, method: 'POST'})
}
// 微信小程序登录
const xcxLogin = params => {
  return Axios.http({url: API + '/weiXin/xcxLogin', data: params, method: 'POST'})
}
// 微信小程序登录
const xcxLoginAndBind = params => {
  return Axios.http({url: API + '/weiXin/xcxLoginAndBind', data: params, method: 'POST'})
}
// 微信小程序注册
const xcxRegister = params => {
  return Axios.http({url: API + '/weiXin/xcxRegister', data: params, method: 'POST'})
}

module.exports = {
  getLocationInfo,
  checkCaptcha,
  getAppletCaptcha,
  passwordLogin,
  phoneLogin,
  checkSms,
  sendForgotPasswordSms,
  sendModifyPhoneNumberSms,
  sendRegisterSms,
  sendXcxLoginSms,
  getPhoneNumberRegistered,
  phoneRegister,
  bindXcxWeiXin,
  unbindWeiXin,
  xcxLogin,
  xcxLoginAndBind,
  xcxRegister
}
